import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'services/database_service.dart';
import 'services/ssh_service.dart';
import 'services/cli_service.dart';
import 'screens/home_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // 初始化服务
  final databaseService = DatabaseService();
  
  final sshService = SSHService();
  final cliService = CLIService();
  
  // 检查命令行参数
  await cliService.handleCommandLineArgs();
  
  runApp(
    MultiProvider(
      providers: [
        Provider<DatabaseService>(create: (_) => databaseService),
        Provider<SSHService>(create: (_) => sshService),
        Provider<CLIService>(create: (_) => cliService),
      ],
      child: const CLSSHApp(),
    ),
  );
}

class CLSSHApp extends StatelessWidget {
  const CLSSHApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'CLSSH - SSH客户端',
      debugShowCheckedModeBanner: false, // 添加这一行
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      darkTheme: ThemeData.dark().copyWith(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue,
          brightness: Brightness.dark,
        ),
      ),
      home: const HomeScreen(),
    );
  }
}
